<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<link href="/res/back/css/base.css" rel="stylesheet" type="text/css" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<style>
td{word-wrap: break-word;word-break:break-all;}
</style>
<body>
	<div class="panel panel-info panel-content" >
		<div class="panel-heading" style="height:44px;"> 
			  <form  id="soform" method="post"  action=""> 
				  <div class="input-group" style="width:220px;float:left">
							<input type="text" class="form-control"  name="so_name"  value='${so_name!}' placeholder="公司/手机号/真实姓名"> 
							<span class="input-group-btn">
								<button class="btn btn-default" type="button" onclick="sosuo()">搜索</button>
							</span>
				  </div>
				  <div class="form-group" style="width:200px;float:left;padding-left:5px">
				   <label  for="so_viptype" >是否会员：</label>
			  	   <select class="form-control" style="width:100px;display:inline-block;" id="so_viptype" name="so_viptype"  onchange="sosuo()">
						<option [#if !so_viptype?? || so_viptype==''] selected="selected"  [/#if]  value=""  >全部</option>
						<option [#if so_viptype?? && so_viptype=='1' ] selected="selected"  [/#if]  value="1"  >会员</option>
						<option [#if so_viptype?? && so_viptype=='0' ] selected="selected"  [/#if]  value="0"  >非会员</option>
					</select>
			      </div>
			  </form>

			<a class="btn btn-info add_row" href="/meeting/list.do">
				会议管理
			</a>

		</div>
		<table class="table table-hover table-bordered table-responsive" >
		<tbody>
			<tr>
				<th width="3%">#</th>
				<th width="10%">公司</th>
				<th width="8%">手机</th>
				<th width="8%">真实姓名/职位</th>
				<th width="5%">报名口</th>
				<th width="5%">座位</th>
				<th width="8%">会议名称</th>
				<th width="8%">会议时间</th>
				<th width="8%">签到会议时间</th>
				<th width="5%">是否签到</th>
				<th width="5%">短信发送</th>
				<th width="5%">是否支付</th>
				<th width="5%">会员</th>
				<th width="15%">操作</th>
			</tr>
 
			[#list pagination.list as signUps]
			<tr>
				<td style="text-align: center">${pagination.pageSize * (pagination.pageNo-1)+signUps_index+1}</td>
				<td title="${signUps.companyName!}">[#if signUps.companyName?? && signUps.companyName?length>15]${(signUps.companyName!)?substring(0,15)}...[#else]${signUps.companyName!}[/#if]</td>
				<td>${signUps.mobile!}</td>
				<td>[#if signUps.realName?? && signUps.realName?length>10]${(signUps.realName!)?substring(0,10)}...[#else]${signUps.realName!}[/#if]/${signUps.post!}</td>
				<td>${signUps.gate!}</td>
				<td>${signUps.seatNo!}</td>
				<td>[#if signUps.meeting??]${signUps.meeting.meetingName!}[/#if]</td>
				<td>[#if signUps.meeting??]${(signUps.meeting.meettime?string("yyyy-MM-dd hh:mm"))!}[/#if]</td>
				<td>[#if signUps.meeting??]${(signUps.meeting.signtime?string("yyyy-MM-dd hh:mm"))!}[/#if]</td>
				<td>[#if signUps.seatConfirm??][#if signUps.seatConfirm==1]是[#elseif signUps.seatConfirm==0]否[/#if][/#if]</td>
				<td>[#if signUps.ifMsg??][#if signUps.ifMsg==1]已发送[#elseif signUps.ifMsg==0]未发送[/#if][/#if]</td>
				<td>[#if signUps.ifPay??][#if signUps.ifPay==1]是[#elseif signUps.ifPay==0]否[/#if][/#if]</td>
				<td>[#if signUps.ifMember??][#if signUps.ifMember==1]是[#elseif signUps.ifMember==0]否[/#if][/#if]</td>
				<td style="text-align: center">
					<input value="查看短信" type="button" onclick="getSignInSms(${signUps.id});" class="btn btn-success btn-xs" />
					<input value="发送短信" type="button" onclick="sendSignInSms(${signUps.id});" class="btn btn-warning btn-xs" />
					<input style="margin-top:2px" value="编辑" type="button" onclick="makeSeat(${signUps.id},'${signUps.gate!}','${signUps.seatNo!}','${signUps.post!}',${signUps.wantrole!1},${signUps.ifPay!0},'${signUps.wantcooper!}','${signUps.memo!}');" class="btn btn-info btn-xs" />
					<input style="margin-top:2px" value="删除" type="button" onclick="delsign(${signUps.id});" class="btn btn-danger btn-xs" />
					<input style="margin-left:0px;padding-top:2px" value="详情" type="button" onclick="detailsign(${signUps.id});" class="btn btn-primary btn-xs" />
				</td>
			</tr>
			[/#list]
			</tbody>
		</table>
		<div class="panel-footer">[@fenye p = pagination form = 'infoForm' /]</div>
	</div>
</body>
<!-- 弹框 -->
	<div id="editsign" style="width: 500px;height:150px;display: none;">
		 <form id="editsignfrom" method="post" class="form-horizontal" role="form">
		 		 <input type="hidden" name="id">
			       <div class="form-group">
				      <label  class="col-sm-2 control-label">报名口</label>
				      <div class="col-sm-8">
				         <input type="text" class="form-control" placeholder="请输入报名口" min="1" maxlength="10"  id="gate" name="gate">
				      </div>
			     </div>
			      <div class="form-group">
				      <label  class="col-sm-2 control-label">座位</label>
				      <div class="col-sm-8">
				      <input type="text" class="form-control" placeholder="请输入座位" min="1" maxlength="30"   id="seatNo" name="seatNo">
				      </div>
			     </div>
			     <div class="form-group">
				      <label  class="col-sm-2 control-label">职位</label>
				      <div class="col-sm-8">
				      <input type="text" class="form-control" placeholder="请输入职位" min="1" maxlength="20"   id="post" name="post">
				      </div>
			     </div>
			     <div class="form-group">
				      <label  class="col-sm-2 control-label">担任角色</label>
				      <div class="col-sm-8">
				       <select class="form-control" id="wantrole" name="wantrole">
				       [#if wantrole?? && wantrole?size>0]
				       [#list wantrole as wantrole]
				      <option value="${wantrole.code!}">${wantrole.name!}</option>
				       [/#list]
				       [/#if]
				      </select>
				      </div>
			     </div>
			        <div class="form-group">
				      <label  class="col-sm-2 control-label">是否支付</label>
				      <div class="col-sm-8">
				      <select class="form-control" id="ifPay" name="ifPay">
				      <option value="0">否</option>
				      <option value="1">是</option>
				      </select>
				      </div>
			     </div>
			     <div class="form-group">
				      <label  class="col-sm-2 control-label">合作意向</label>
				      <div class="col-sm-8">
				      <textarea style="resize:none;" class="form-control" maxlength="255" id="wantcooper" name="wantcooper"  ></textarea>
				      </div>
			     </div>
			     <div class="form-group">
				      <label  class="col-sm-2 control-label">备注</label>
				      <div class="col-sm-8">
				      <textarea style="resize:none;" class="form-control" maxlength="500" id="memo" name="memo"  ></textarea>
				      </div>
			     </div>
   				<div class="form-group" style="margin-top: 10px;">
				      <div class="col-sm-offset-2 col-sm-8">
				         <button  type="button" onclick="sub()" class="btn btn-default">提交</button>
				      </div>
   				</div>
		 </form>
	</div>
	<!-- 短信信息详情 -->
	<div id="msgDetail" stye="display: none;">
	</div>
</html>

<script type="text/javascript">
function sosuo(){
	var lpath =location.pathname;
	$("#soform").attr("action",lpath);
	$("#soform").submit();
}

//安排座位
function makeSeat(id,gate,seatNo,post,wantrole,ifPay,wantcooper,memo){
	var addid=document.getElementById('editsign');
	document.getElementById('editsignfrom').reset();
	$(addid).find("[name='id']").val(id);
	$(addid).find("[name='gate']").val(gate);
	$(addid).find("[name='seatNo']").val(seatNo);
	$(addid).find("[name='post']").val(post);
	$(addid).find("[name='wantrole']").val(wantrole);
	$(addid).find("[name='ifPay']").val(ifPay);
	$(addid).find("[name='wantcooper']").val(wantcooper);
	$(addid).find("[name='memo']").val(memo);
	dialog = art.dialog({
	        title: "编辑数据",
	        lock:true,
	        content: addid
	    });
}

//提交数据
function sub(){
	var data=$("#editsignfrom").serialize();
	art.dialog.post({
		url : 'o_editsign.do',
		data : data,
		success : function(data){
			if(data.success){
				location.reload();
			}else{
				art.dialog.tips(data.msg);
			}
		}
	});
}

//删除
function delsign(id){
	 if(confirm("是否确认删除？")){
		 $.ajax({
			   type: "post",
			   dataType:"json",
			   url: "ajax_delsign.do",
			   data:{id:id},
			   success: function(data){//成功的时候调用
				   if(data.success){
						location.reload();
				   }else{
					   art.dialog.tips(data.msg);
				   }
			   }
		});
	 }
}

//发送短信
function sendSignInSms(id){
	if(confirm("是否发送短信？发送前建议先查看短信内容")){
		 $.ajax({
			   type: "post",
			   dataType:"json",
			   url: "ajax_signMsg.do",
			   data:{id:id},
			   success: function(data){//成功的时候调用
				   if(data.success){
						location.reload();
				   }else{
					   art.dialog.tips(data.msg);
				   }
			   }
		});
	 }
}

//查看短信
function getSignInSms(id){
	 $.ajax({
		   type: "post",
		   dataType:"json",
		   url: "get_signMsg.do",
		   data:{id:id},
		   success: function(data){//成功的时候调用
			   if(data.success){
					alert(data.msg);
			   }else{
				   art.dialog.tips(data.msg);
			   }
		   }
	});
}

//查看详情
function detailsign(id){
	top.addTempTab("/signup/sign_detail.do?id="+id);
}
</script>